<?php
class getMy_model extends Model{
	
	function getMy_model()
	{
		parent::Model();
	}
	
	function get_myMark($uid)
	{
		$this->db->select('mark');
		$this->db->where('id',$uid);
		$myMark = $this->db->get('ci_ask_user');
		return $myMark->result();
	}
	
	function get_myQuestion($uid)
	{
		$this->db->select(' ci_ask_question.title as qtitle,
							ci_ask_question.id as qid,
							ci_ask_ccat.name as cname,
							ci_ask_ccat.id as cid,
							ci_ask_question.postdate as qpostdate,
							ci_ask_question.answercount as qanswercount,
							ci_ask_question.price as qprice,
						  ');
		$this->db->join('ci_ask_ccat','ci_ask_question.cid = ci_ask_ccat.id');
		$this->db->where('ci_ask_question.uid',$uid);
		$myQuestion = $this->db->get('ci_ask_question');
		return $myQuestion->result();
	}
	
	function get_myAnswer($uid)
	{
		$this->db->select(' ci_ask_question.title as qtitle,
							ci_ask_question.id as qid,
							ci_ask_ccat.name as cname,
							ci_ask_ccat.id as cid,
							ci_ask_question.postdate as qpostdate,
							ci_ask_question.answercount as qanswercount,
							ci_ask_question.price as qprice,
						  ');
		$this->db->join('ci_ask_ccat','ci_ask_question.cid = ci_ask_ccat.id');
		$this->db->join('ci_ask_answer','ci_ask_answer.qid = ci_ask_question.id');
		$this->db->where('ci_ask_answer.uid',$uid);
		$myQuestion = $this->db->get('ci_ask_question');
		return $myQuestion->result();
	}
	
	function get_mySolvedQuestion($uid)
	{
		$this->db->select(' ci_ask_question.title as qtitle,
							ci_ask_question.id as qid,
							ci_ask_ccat.name as cname,
							ci_ask_answer.id as aid,
							ci_ask_ccat.id as cid,
							ci_ask_question.postdate as qpostdate,
							ci_ask_question.answercount as qanswercount,
							ci_ask_question.price as qprice,
						  ');
		$this->db->join('ci_ask_ccat','ci_ask_question.cid = ci_ask_ccat.id');
		$this->db->join('ci_ask_answer','ci_ask_question.id = ci_ask_answer.qid');
		$this->db->where('ci_ask_answer.isbest','1');
		$this->db->where('ci_ask_answer.uid',$uid);
		$mySolvedQuestion = $this->db->get('ci_ask_question');
		return $mySolvedQuestion->result();
	}
}
?>